import mockApi from "@/api/mockApi";

export default class parkingAreaApi {
  static parkingAreas = [
    {id: 1, areaNumber: '010', buildingId: 1, buildingName: '北区1栋', floorNumber: '负一', residentRoomId: 1, residentRoomNumber: '301', licensePlate: '粤A11111', status: 20, createTime: '2024-01-01 12:12:12', modifyTime: '2024-02-02 13:13:13'},
    {id: 2, areaNumber: '021', buildingId: 2, buildingName: '北区1栋', floorNumber: '负一', residentRoomId: 1, residentRoomNumber: '402', licensePlate: '粤A11112', status: 10, createTime: '2024-02-02 12:12:12', modifyTime: '2024-03-03 13:13:13'},
    {id: 3, areaNumber: '032', buildingId: 3, buildingName: '南区1栋', floorNumber: '负二', residentRoomId: 1, residentRoomNumber: '503', licensePlate: '粤A11113', status: 20, createTime: '2024-03-03 12:12:12', modifyTime: '2024-04-04 13:13:13'},
    {id: 4, areaNumber: '043', buildingId: 4, buildingName: '南区2栋', floorNumber: '负二', residentRoomId: 1, residentRoomNumber: '604', licensePlate: '粤A11114', status: 10, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'},
    {id: 5, areaNumber: '038', buildingId: 5, buildingName: '东区1栋', floorNumber: '负一', residentRoomId: 1, residentRoomNumber: '204', licensePlate: '粤A11115', status: 20, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'},
    {id: 6, areaNumber: '029', buildingId: 6, buildingName: '东区2栋', floorNumber: '负一', residentRoomId: 1, residentRoomNumber: '404', licensePlate: '粤A11116', status: 30, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'}
  ]

  static async save (params) {
    console.log('parkingAreaApi save params', params)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }

  static async find (params) {
    console.log('parkingAreaApi find params', params)
    const response = await mockApi.queryPageSuccessfully(parkingAreaApi.parkingAreas)
    return response.data
  }

  static async findById (id) {
    console.log('parkingAreaApi findById id', id)
    let target = {}
    for (let a of parkingAreaApi.parkingAreas) {
      if (a.id === id) {
        target = a
      }
    }
    const response = await mockApi.queryByIdSuccessfully(target)
    return response.data
  }

  static async del (id) {
    console.log('parkingAreaApi del id', id)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }
}